package com.wealth.scsj.b_app.view.fragment.callmodel;


import android.os.Bundle;
import android.support.v4.view.ViewPager;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.gigamole.navigationtabstrip.NavigationTabStrip;
import com.wealth.scsj.b_app.R;
import com.wealth.scsj.b_app.adapter.FragmentAdapter;
import com.wealth.scsj.b_app.view.fragment.basemodel.BaseFragment;
import com.wealth.scsj.b_app.view.fragment.commentmodel.AllCommentFragment;
import com.wealth.scsj.b_app.view.fragment.commentmodel.NoAndBadCommentFragment;
import com.wealth.scsj.b_app.view.fragment.commentmodel.NoCommentFragment;

import java.util.ArrayList;

/**
 * 左侧评价列表
 */
public class LeftCommFragment extends BaseFragment {

    private NavigationTabStrip tabStrip;
    private ViewPager mViewPager;
    private FragmentAdapter mainFragmentAdapter;
    private String[] titles = {"未回复差评", "未回复", "全部"};
    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        View inflate = inflater.inflate(R.layout.fragment_left_comm_layout, null);
        initView(inflate,savedInstanceState);
        initData();
        initListener();

        return inflate;
    }

    @Override
    protected void initView(View view, Bundle savedInstanceState) {

        intiNavigationBar(view);
    }

    @Override
    protected void initListener() {

    }

    @Override
    protected void initData() {

    }

    @Override
    protected int getLayoutId() {
        return 0;
    }

    private void intiNavigationBar(View view) {

        //顶部指示器
        tabStrip = view.findViewById(R.id.mediator_tab);
        mViewPager = view.findViewById(R.id.viewpager);
        mViewPager.setOffscreenPageLimit(3);
        ArrayList<BaseFragment> list = new ArrayList<>();


        NoAndBadCommentFragment noAndBadCommentFragment = new NoAndBadCommentFragment();
        NoCommentFragment noCommentFragment = new NoCommentFragment();
        AllCommentFragment allCommentFragment = new AllCommentFragment();

        list.add(noAndBadCommentFragment);
        list.add(noCommentFragment);
        list.add(allCommentFragment);

        mainFragmentAdapter = new FragmentAdapter(getChildFragmentManager(), list);

        mViewPager.setAdapter(mainFragmentAdapter);
        tabStrip.setViewPager(mViewPager, 0);
        tabStrip.setTitles(titles);
        tabStrip.setStripType(NavigationTabStrip.StripType.LINE);
        tabStrip.setStripGravity(NavigationTabStrip.StripGravity.BOTTOM);
        tabStrip.setTabIndex(0, true);
    }


}
